package main;

import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpUtil;

/**
 * 发送消息
 *
 * @author hanj.cn @outlook.com
 */
public class SendMsg {

    /**
     * 发送消息到bark客户端
     *
     * @param groupName 组名
     * @param title     标题
     * @param content   内容
     */
    public static void toBark(String groupName, String title, String content) {

        // 拼接url
        String url = Initialize.getIp() + "/" + Initialize.getDeviceCode() + "/" + cn.hutool.core.util.URLUtil.encode(title) + "/" + cn.hutool.core.util.URLUtil.encode(content) + "?group=" + cn.hutool.core.util.URLUtil.encode(groupName);

        // 发送请求
        HttpUtil.get(url);

    }

    /**
     * To push bear.
     *
     * @param UUID the uuid
     * @param msg  the msg
     */
    public static void toPushBear(String UUID, String msg) {
        
        String url = "https://push.caihongpi.net/api/v1/push/" + UUID + "?msg=" + URLUtil.encode(msg) + "&type=0&sound=0";
        HttpUtil.get(url);
    }

}
